package wt.ai.chatagentservice.service.impl;

import dev.langchain4j.agent.tool.Tool;
import org.springframework.stereotype.Service;
import wt.ai.chatagentservice.domain.CustomerInfo;
import wt.ai.chatagentservice.domain.OrderInfo;
import wt.ai.chatagentservice.service.ToolService;

import java.util.ArrayList;
import java.util.List;

@Service
public class ToolServiceImpl implements ToolService {


    @Tool("根据客户名称查询客户的相关信息,展示了客户的姓名，年龄、手机号、邮箱、性别信息")
    @Override
    public CustomerInfo searchCustomerInfo(String customerName) {
        // 这里我们可以实现一个API或者我们的CRM系统
        CustomerInfo customerInfo = new CustomerInfo();
        customerInfo.setName(customerName);
        customerInfo.setAge("30");
        customerInfo.setPhone("15975336234");
        customerInfo.setEmail("zhangsan@gmail.com");
        customerInfo.setSex("男");
        customerInfo.setCustomerId("1");
        return customerInfo;
    }

    @Tool("根据客户名称查询客户中的客户编号，查询客户当前的订单信息")
    @Override
    public List<OrderInfo> searchOrderList(String customerId) {

        List<OrderInfo> list = new ArrayList<OrderInfo>();

        OrderInfo d1 = new OrderInfo();
        d1.setCustomerId("1");
        d1.setOrderStatus("0");
        d1.setOrderId("1");
        list.add(d1);

        OrderInfo d2 = new OrderInfo();
        d2.setCustomerId("1");
        d2.setOrderStatus("2");
        d2.setOrderId("2");
        list.add(d2);


        return list;
    }
}
